package com.example.demo.test;

/**
 * @auth
 **/
public class Node<T> {
    T value;
    Node<T> leftChild;
    Node<T> rigthChild;
    Node(T value){
        this.value=value;
    }
    Node(){}
    public void addLeft(T value){
        Node<T> leftChild = new Node<>(value);
        this.leftChild = leftChild;
    }
    public void addRight(T value){
        Node<T> rigthChild = new Node<>(value);
        this.rigthChild = rigthChild;
    }
    @Override
    public boolean equals(Object obj) {
        // TODO Auto-generated method stub
        if(!(obj instanceof Node)){
            return false;
        }
        return this.value.equals(((Node<?>)obj).value);
    }
    @Override
    public int hashCode() {
        // TODO Auto-generated method stub
        return this.value.hashCode();
    }
    @Override
    public String toString(){
        return this.value==null?"":this.value.toString();
    }
}
